package com.eascs.web.o2o.web.service;

import java.util.List;

import javax.inject.Inject;

import org.springframework.stereotype.Service;

import com.eascs.app.context.ConfigContext;
import com.eascs.app.dao.JdbcSession;
import com.eascs.app.dao.PageResult;
import com.eascs.app.dao.SqlPageQuery;
import com.eascs.app.dao.sql.ObjectSqlBuilder;
import com.eascs.web.o2o.web.form.BadStatmentForm;

@Service
public class BadStatmentService {

	@Inject
	JdbcSession jdbcSessionO2OService;
	
	
	
	public PageResult<Object[]> BadStatmentList(BadStatmentForm form) {
		SqlPageQuery<Object[]> sqlPageQuery = new SqlPageQuery<Object[]>(Object[].class,form.getPageSize(),form.getPageIndex());
		ObjectSqlBuilder objectSqlBuilder = ObjectSqlBuilder.create(form,"");
		sqlPageQuery.setQuerySql(ConfigContext.getStringValue("sql.BadStatmentService.badStatment")+objectSqlBuilder.getSql());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParam(form.getEndDate());
		sqlPageQuery.addParams(objectSqlBuilder.getParams());
		//sqlPageQuery.setSumColumnIndexs(new int[] { 1,2, 3, 4, 5, 6, 7, 8,9,10,11});
		return jdbcSessionO2OService.findDataWithPage(sqlPageQuery);
	}
}
